package com.lc.afbx.conn;

import android.util.Log;

import com.zcx.helper.http.AsyCallBack;
import com.zcx.helper.http.note.HttpInlet;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2016/6/8.
 */
@HttpInlet(Conn.INLET_API_TEAM_POLICY)
public class GetApiTeamMemberBaoDan extends BaseAsyGet<GetApiTeamMemberBaoDan.Info> {
    public String userid;

    public GetApiTeamMemberBaoDan(AsyCallBack<GetApiTeamMemberBaoDan.Info> asyCallBack) {
        super(asyCallBack);
    }

    protected Info parser(JSONObject jsonObject) {

        TOAST = jsonObject.optString("message");



            JSONArray array = jsonObject.optJSONArray("data");
            Info info = new Info();
            info.num = jsonObject.optString("num");
            info.username = jsonObject.optString("username");
            for (int i = 0; i < array.length(); i++) {

                JSONObject o = array.optJSONObject(i);
                Data d = new Data();

                d.name = o.optString("name");
                d.id = o.optString("id");
                d.starttime = o.optString("starttime");
                d.total = o.optString("total");
                d.insurance_type = o.optString("insurance_type");
                d.commission = o.optString("commission");
                d.rebate = o.optString("rebate");
                d.ordersn = o.optString("ordersn");

                info.dataList.add(d);

            }
            return info;


    }

    public static class Info {
        //        "username": "小明。",
//                "num": 7
        public String username, num;
        public List<Data> dataList = new ArrayList<>();
    }

    public static class Data {

        //        "id": "3",
//                "ordersn": "c201606019810149517",
//                "name": "小明",
//                "starttime": "2016-06-01",
//                "total": "0.00",
//                "insurance_type": "交强险",
//                "commission": 0,
//                "rebate": "0.08"
        public String id, ordersn, name, starttime, total, insurance_type, commission, rebate;
    }
}
